<?php
$tdataproducts=array();
	$tdataproducts[".NumberOfChars"]=80; 
	$tdataproducts[".ShortName"]="products";
	$tdataproducts[".OwnerID"]="";
	$tdataproducts[".OriginalTable"]="products";


	
//	field labels
$fieldLabelsproducts = array();
if(mlang_getcurrentlang()=="English")
{
	$fieldLabelsproducts["English"]=array();
	$fieldToolTipsproducts["English"]=array();
	$fieldLabelsproducts["English"]["id"] = "Id";
	$fieldToolTipsproducts["English"]["id"] = "";
	$fieldLabelsproducts["English"]["product_code"] = "Product Code";
	$fieldToolTipsproducts["English"]["product_code"] = "";
	$fieldLabelsproducts["English"]["product_name"] = "Product Name";
	$fieldToolTipsproducts["English"]["product_name"] = "";
	if (count($fieldToolTipsproducts["English"])){
		$tdataproducts[".isUseToolTips"]=true;
	}
}
if(mlang_getcurrentlang()=="Chinese (Hong Kong S.A.R.)")
{
	$fieldLabelsproducts["Chinese (Hong Kong S.A.R.)"]=array();
	$fieldToolTipsproducts["Chinese (Hong Kong S.A.R.)"]=array();
	$fieldLabelsproducts["Chinese (Hong Kong S.A.R.)"]["id"] = "Id";
	$fieldToolTipsproducts["Chinese (Hong Kong S.A.R.)"]["id"] = "";
	$fieldLabelsproducts["Chinese (Hong Kong S.A.R.)"]["product_code"] = "Product Code";
	$fieldToolTipsproducts["Chinese (Hong Kong S.A.R.)"]["product_code"] = "";
	$fieldLabelsproducts["Chinese (Hong Kong S.A.R.)"]["product_name"] = "Product Name";
	$fieldToolTipsproducts["Chinese (Hong Kong S.A.R.)"]["product_name"] = "";
	if (count($fieldToolTipsproducts["Chinese (Hong Kong S.A.R.)"])){
		$tdataproducts[".isUseToolTips"]=true;
	}
}
if(mlang_getcurrentlang()=="Chinese (Taiwan)")
{
	$fieldLabelsproducts["Chinese (Taiwan)"]=array();
	$fieldToolTipsproducts["Chinese (Taiwan)"]=array();
	$fieldLabelsproducts["Chinese (Taiwan)"]["id"] = "Id";
	$fieldToolTipsproducts["Chinese (Taiwan)"]["id"] = "";
	$fieldLabelsproducts["Chinese (Taiwan)"]["product_code"] = "Product Code";
	$fieldToolTipsproducts["Chinese (Taiwan)"]["product_code"] = "";
	$fieldLabelsproducts["Chinese (Taiwan)"]["product_name"] = "Product Name";
	$fieldToolTipsproducts["Chinese (Taiwan)"]["product_name"] = "";
	if (count($fieldToolTipsproducts["Chinese (Taiwan)"])){
		$tdataproducts[".isUseToolTips"]=true;
	}
}
if(mlang_getcurrentlang()=="French")
{
	$fieldLabelsproducts["French"]=array();
	$fieldToolTipsproducts["French"]=array();
	if (count($fieldToolTipsproducts["French"])){
		$tdataproducts[".isUseToolTips"]=true;
	}
}


	
	$tdataproducts[".NCSearch"]=true;

	

$tdataproducts[".shortTableName"] = "products";
$tdataproducts[".nSecOptions"] = 0;
$tdataproducts[".recsPerRowList"] = 1;	
$tdataproducts[".tableGroupBy"] = "0";
$tdataproducts[".mainTableOwnerID"] = "";
$tdataproducts[".moveNext"] = 1;




$tdataproducts[".showAddInPopup"] = false;

$tdataproducts[".showEditInPopup"] = false;

$tdataproducts[".showViewInPopup"] = false;


$tdataproducts[".fieldsForRegister"] = array();

$tdataproducts[".listAjax"] = true;

	$tdataproducts[".audit"] = false;

	$tdataproducts[".locking"] = false;
	
$tdataproducts[".listIcons"] = true;
$tdataproducts[".edit"] = true;
$tdataproducts[".inlineEdit"] = true;
$tdataproducts[".view"] = true;

$tdataproducts[".exportTo"] = true;

$tdataproducts[".printFriendly"] = true;

$tdataproducts[".delete"] = true;

$tdataproducts[".showSimpleSearchOptions"] = true;

$tdataproducts[".showSearchPanel"] = true;


$tdataproducts[".isUseAjaxSuggest"] = true;

$tdataproducts[".rowHighlite"] = true;


// button handlers file names

$tdataproducts[".addPageEvents"] = false;

$tdataproducts[".arrKeyFields"][] = "id";

// use datepicker for search panel
$tdataproducts[".isUseCalendarForSearch"] = false;

// use timepicker for search panel
$tdataproducts[".isUseTimeForSearch"] = false;

$tdataproducts[".isUseiBox"] = false;


$tdataproducts[".useDetailsPreview"] = true;	

$tdataproducts[".isUseInlineAdd"] = true;

$tdataproducts[".isUseInlineEdit"] = true;
$tdataproducts[".isUseInlineJs"] = $tdataproducts[".isUseInlineAdd"] || $tdataproducts[".isUseInlineEdit"];

$tdataproducts[".allSearchFields"] = array();

$tdataproducts[".globSearchFields"][] = "id";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("id", $tdataproducts[".allSearchFields"]))
{
	$tdataproducts[".allSearchFields"][] = "id";	
}
$tdataproducts[".globSearchFields"][] = "product_code";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("product_code", $tdataproducts[".allSearchFields"]))
{
	$tdataproducts[".allSearchFields"][] = "product_code";	
}
$tdataproducts[".globSearchFields"][] = "product_name";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("product_name", $tdataproducts[".allSearchFields"]))
{
	$tdataproducts[".allSearchFields"][] = "product_name";	
}


$tdataproducts[".googleLikeFields"][] = "id";
$tdataproducts[".googleLikeFields"][] = "product_code";
$tdataproducts[".googleLikeFields"][] = "product_name";



$tdataproducts[".advSearchFields"][] = "id";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("id", $tdataproducts[".allSearchFields"])) 
{
	$tdataproducts[".allSearchFields"][] = "id";	
}
$tdataproducts[".advSearchFields"][] = "product_code";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("product_code", $tdataproducts[".allSearchFields"])) 
{
	$tdataproducts[".allSearchFields"][] = "product_code";	
}
$tdataproducts[".advSearchFields"][] = "product_name";
// do in this way, because combine functions array_unique and array_merge returns array with keys like 1,2, 4 etc
if (!in_array("product_name", $tdataproducts[".allSearchFields"])) 
{
	$tdataproducts[".allSearchFields"][] = "product_name";	
}

$tdataproducts[".isTableType"] = "list";


	

$tdataproducts[".isDisplayLoading"] = true;

$tdataproducts[".isResizeColumns"] = false;

	$tdataproducts[".subQueriesSupAccess"] = true;




$tdataproducts[".pageSize"] = 20;

$gstrOrderBy = "";
if(strlen($gstrOrderBy) && strtolower(substr($gstrOrderBy,0,8))!="order by")
	$gstrOrderBy = "order by ".$gstrOrderBy;
$tdataproducts[".strOrderBy"] = $gstrOrderBy;
	
$tdataproducts[".orderindexes"] = array();

$tdataproducts[".sqlHead"] = "SELECT id,   product_code,   product_name";
$tdataproducts[".sqlFrom"] = "FROM products";
$tdataproducts[".sqlWhereExpr"] = "";
$tdataproducts[".sqlTail"] = "";




//fill array of records per page for list and report without group fields
$arrRPP = array();
$arrRPP[] = 10;
$arrRPP[] = 20;
$arrRPP[] = 30;
$arrRPP[] = 50;
$arrRPP[] = 100;
$arrRPP[] = 500;
$arrRPP[] = -1;
$tdataproducts[".arrRecsPerPage"] = $arrRPP;

//fill array of groups per page for report with group fields
$arrGPP = array();
$arrGPP[] = 1;
$arrGPP[] = 3;
$arrGPP[] = 5;
$arrGPP[] = 10;
$arrGPP[] = 50;
$arrGPP[] = 100;
$arrGPP[] = -1;
$tdataproducts[".arrGroupsPerPage"] = $arrGPP;

	$tableKeys = array();
	$tableKeys[] = "id";
	$tdataproducts[".Keys"] = $tableKeys;

//	id
	$fdata = array();
	$fdata["strName"] = "id";
	$fdata["ownerTable"] = "products";
		$fdata["Label"]="Id"; 
	
		
		
	$fdata["FieldType"]= 3;
	
		
			$fdata["UseiBox"] = false;
	
	$fdata["EditFormat"]= "Text field";
	$fdata["ViewFormat"]= "";
	
		
		
		
		
		$fdata["NeedEncode"]=true;
	
	$fdata["GoodName"]= "id";
	
		$fdata["FullName"]= "id";
	
		$fdata["IsRequired"]=true; 
	
		
		
		
		
				$fdata["Index"]= 1;
				$fdata["EditParams"]="";
			
		$fdata["bListPage"]=true; 
	
		
		
		
		
		$fdata["bViewPage"]=true; 
	
		$fdata["bAdvancedSearch"]=true; 
	
		$fdata["bPrinterPage"]=true; 
	
		$fdata["bExportPage"]=true; 
	
	//Begin validation
	$fdata["validateAs"] = array();
				$fdata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");	
						$fdata["validateAs"]["basicValidate"][] = "IsRequired";
	
		//End validation
	
				$fdata["FieldPermissions"]=true;
	
		
				
		
		
		
			$tdataproducts["id"]=$fdata;
//	product_code
	$fdata = array();
	$fdata["strName"] = "product_code";
	$fdata["ownerTable"] = "products";
		$fdata["Label"]="Product Code"; 
	
		
		
	$fdata["FieldType"]= 200;
	
		
			$fdata["UseiBox"] = false;
	
	$fdata["EditFormat"]= "Text field";
	$fdata["ViewFormat"]= "";
	
		
		
		
		
		$fdata["NeedEncode"]=true;
	
	$fdata["GoodName"]= "product_code";
	
		$fdata["FullName"]= "product_code";
	
		
		
		
		
		
				$fdata["Index"]= 2;
				$fdata["EditParams"]="";
			$fdata["EditParams"].= " maxlength=50";
		
		$fdata["bListPage"]=true; 
	
		$fdata["bAddPage"]=true; 
	
		$fdata["bInlineAdd"]=true; 
	
		$fdata["bEditPage"]=true; 
	
		$fdata["bInlineEdit"]=true; 
	
		$fdata["bViewPage"]=true; 
	
		$fdata["bAdvancedSearch"]=true; 
	
		$fdata["bPrinterPage"]=true; 
	
		$fdata["bExportPage"]=true; 
	
	//Begin validation
	$fdata["validateAs"] = array();
		
		//End validation
	
				$fdata["FieldPermissions"]=true;
	
		
				
		
		
		
			$tdataproducts["product_code"]=$fdata;
//	product_name
	$fdata = array();
	$fdata["strName"] = "product_name";
	$fdata["ownerTable"] = "products";
		$fdata["Label"]="Product Name"; 
	
		
		
	$fdata["FieldType"]= 200;
	
		
			$fdata["UseiBox"] = false;
	
	$fdata["EditFormat"]= "Text field";
	$fdata["ViewFormat"]= "";
	
		
		
		
		
		$fdata["NeedEncode"]=true;
	
	$fdata["GoodName"]= "product_name";
	
		$fdata["FullName"]= "product_name";
	
		
		
		
		
		
				$fdata["Index"]= 3;
				$fdata["EditParams"]="";
			$fdata["EditParams"].= " maxlength=255";
		
		$fdata["bListPage"]=true; 
	
		$fdata["bAddPage"]=true; 
	
		$fdata["bInlineAdd"]=true; 
	
		$fdata["bEditPage"]=true; 
	
		$fdata["bInlineEdit"]=true; 
	
		$fdata["bViewPage"]=true; 
	
		$fdata["bAdvancedSearch"]=true; 
	
		$fdata["bPrinterPage"]=true; 
	
		$fdata["bExportPage"]=true; 
	
	//Begin validation
	$fdata["validateAs"] = array();
		
		//End validation
	
				$fdata["FieldPermissions"]=true;
	
		
				
		
		
		
			$tdataproducts["product_name"]=$fdata;

	
$tables_data["products"]=&$tdataproducts;
$field_labels["products"] = &$fieldLabelsproducts;
$fieldToolTips["products"] = &$fieldToolTipsproducts;

// -----------------start  prepare master-details data arrays ------------------------------//
// tables which are detail tables for current table (master)
$detailsTablesData["products"] = array();
$dIndex = 1-1;
			$strOriginalDetailsTable="sales_order_items";
	$detailsTablesData["products"][$dIndex] = array(
		  "dDataSourceTable"=>"sales_order_items"
		, "dOriginalTable"=>$strOriginalDetailsTable
		, "dShortTable"=>"sales_order_items"
		, "masterKeys"=>array()
		, "detailKeys"=>array()
		, "dispChildCount"=> "1"
		, "hideChild"=>"1"
		, "sqlHead"=>"SELECT id,   sales_order_id,   item_no,   product_id,   property_id,   size_system_id,   unit_price,   total_quantity,   size_breakup_id,   delivery_date,   status"	
		, "sqlFrom"=>"FROM sales_order_items"	
		, "sqlWhere"=>""
		, "sqlTail"=>""
		, "groupBy"=>"0"
		, "previewOnList" => 1
		, "previewOnAdd" => 1
		, "previewOnEdit" => 1
		, "previewOnView" => 1
	);	
		$detailsTablesData["products"][$dIndex]["masterKeys"][]="id";
		$detailsTablesData["products"][$dIndex]["detailKeys"][]="product_id";


	
// tables which are master tables for current table (detail)
$masterTablesData["products"] = array();

// -----------------end  prepare master-details data arrays ------------------------------//

require_once(getabspath("classes/sql.php"));










$proto342=array();
$proto342["m_strHead"] = "SELECT";
$proto342["m_strFieldList"] = "id,   product_code,   product_name";
$proto342["m_strFrom"] = "FROM products";
$proto342["m_strWhere"] = "";
$proto342["m_strOrderBy"] = "";
$proto342["m_strTail"] = "";
$proto343=array();
$proto343["m_sql"] = "";
$proto343["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto343["m_column"]=$obj;
$proto343["m_contained"] = array();
$proto343["m_strCase"] = "";
$proto343["m_havingmode"] = "0";
$proto343["m_inBrackets"] = "0";
$proto343["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto343);

$proto342["m_where"] = $obj;
$proto345=array();
$proto345["m_sql"] = "";
$proto345["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto345["m_column"]=$obj;
$proto345["m_contained"] = array();
$proto345["m_strCase"] = "";
$proto345["m_havingmode"] = "0";
$proto345["m_inBrackets"] = "0";
$proto345["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto345);

$proto342["m_having"] = $obj;
$proto342["m_fieldlist"] = array();
						$proto347=array();
			$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "products"
));

$proto347["m_expr"]=$obj;
$proto347["m_alias"] = "";
$obj = new SQLFieldListItem($proto347);

$proto342["m_fieldlist"][]=$obj;
						$proto349=array();
			$obj = new SQLField(array(
	"m_strName" => "product_code",
	"m_strTable" => "products"
));

$proto349["m_expr"]=$obj;
$proto349["m_alias"] = "";
$obj = new SQLFieldListItem($proto349);

$proto342["m_fieldlist"][]=$obj;
						$proto351=array();
			$obj = new SQLField(array(
	"m_strName" => "product_name",
	"m_strTable" => "products"
));

$proto351["m_expr"]=$obj;
$proto351["m_alias"] = "";
$obj = new SQLFieldListItem($proto351);

$proto342["m_fieldlist"][]=$obj;
$proto342["m_fromlist"] = array();
												$proto353=array();
$proto353["m_link"] = "SQLL_MAIN";
			$proto354=array();
$proto354["m_strName"] = "products";
$proto354["m_columns"] = array();
$proto354["m_columns"][] = "id";
$proto354["m_columns"][] = "product_code";
$proto354["m_columns"][] = "product_name";
$obj = new SQLTable($proto354);

$proto353["m_table"] = $obj;
$proto353["m_alias"] = "";
$proto355=array();
$proto355["m_sql"] = "";
$proto355["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto355["m_column"]=$obj;
$proto355["m_contained"] = array();
$proto355["m_strCase"] = "";
$proto355["m_havingmode"] = "0";
$proto355["m_inBrackets"] = "0";
$proto355["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto355);

$proto353["m_joinon"] = $obj;
$obj = new SQLFromListItem($proto353);

$proto342["m_fromlist"][]=$obj;
$proto342["m_groupby"] = array();
$proto342["m_orderby"] = array();
$obj = new SQLQuery($proto342);

$queryData_products = $obj;
$tdataproducts[".sqlquery"] = $queryData_products;

$tableEvents["products"] = new eventsBase;

?>
